# Kithara 内核库

# 设置策略CMP0091为NEW，新策略 用于MT/MD等编译选项的配置
if(POLICY CMP0091)
    cmake_policy(SET CMP0091 NEW)
endif(POLICY CMP0091)

project(Kernel)

add_library(Kernel SHARED
        Kithara.cpp
        kernel_operation.cpp
        kernel_operation.h
)

if(WIN32)
    # 自动导出符号
    set_target_properties(Kernel PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)

    # 链接库
    target_link_libraries(Kernel PUBLIC
            LinkControl_x64.lib
    )
endif()

if(MSVC)
    # 设置MT/MTd
    set_property(TARGET Kernel PROPERTY
            MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()


#构建完成后，执行CMD指令进行Kithara签名，该方法是本地签名
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
        COMMAND  ./Ksign.exe -customer="070075" -driver="LinkControl" -sign="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Kernel.dll"
        WORKING_DIRECTORY  ${KITHARA_INCLUDE_PATH}
        COMMENT "Running kithara sign script"
)